<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;
use app\common\middleware\AuthCheckToken;
use app\common\middleware\AllowCrossDomain;

Route::get('think', function () {
    return 'hello,ThinkPHP6!';
});

Route::get('hello/:name', 'index/hello');

Route::get('queue/getNumber', 'Queue/getNumber');
Route::get('queue/callNumber', 'Queue/callNumber');
Route::get('queue/getQueueStatus', 'Queue/getQueueStatus');

Route::post('like/like/', 'Like/like');
Route::get('like/getLikeCount/', 'Like/getLikeCount');
Route::get('like/getUserLikes/:userId', 'Like/getUserLikes');

Route::post('excel/import', 'Excel/import');
Route::post('excel/merge', 'Excel/merge');
Route::post('excel/exportExcel', 'Excel/exportExcel');

Route::get('couplet', 'couplet/index');
Route::post('couplet/identify', 'couplet/identify');

Route::post('user/register', 'User/register');
Route::post('user/login', 'User/login');
Route::get('dish/index', 'Dish/index');
Route::post('dish/store', 'Dish/store');
Route::post('order/store', 'Order/store');
Route::get('order/index', 'Order/index');
Route::post('order/updateStatus', 'Order/updateStatus');

Route::group(function () {
    Route::post('login', 'Login/login');
    Route::get('captcha', 'Login/verify');
    Route::get('loginout', 'Login/logout');
    Route::get('clear', 'Login/clear');

    Route::group('member', function () {
        Route::get('/info', 'system.Member/info');
        Route::post('/add', 'system.Member/add');
        Route::post('/index', 'system.Member/index');
        Route::get('/del', 'system.Member/del');
        Route::post('/edit', 'system.Member/edit');
        Route::get('/findMemberRole', 'system.Member/findMemberRole');
    })->middleware([AuthCheckToken::class]);

    Route::group('menu', function () {
        Route::get('/router', 'system.Menu/getRouter');
        Route::get('/tree', 'system.Menu/menuTree');
        Route::post('/add', 'system.Menu/add');
        Route::post('/edit', 'system.Menu/edit');
        Route::get('/changeStatus', 'system.Menu/changeStatus');
        Route::post('/changeOrder', 'system.Menu/changeOrder');
        Route::get('/del', 'system.Menu/del');
    })->middleware([AuthCheckToken::class]);

    Route::group('role', function () {
        Route::post('/index', 'system.Role/index');
        Route::post('/add', 'system.Role/add');
        Route::get('/del', 'system.Role/del');
        Route::post('/edit', 'system.Role/edit');
        Route::get('/selectRoleMenuId', 'system.Role/selectRoleMenuId');
        Route::get('/changeStatus', 'system.Menu/changeStatus');
        Route::post('/changeOrder', 'system.Menu/changeOrder');
        Route::get('/selectRole', 'system.Role/selectRole');
    })->middleware([AuthCheckToken::class]);

    Route::group('dept', function () {
        Route::get('/tree', 'system.Dept/deptTree');
        Route::post('/add', 'system.Dept/add');
        Route::post('/edit', 'system.Dept/edit');
        Route::post('/changeOrder', 'system.Dept/changeOrder');
        Route::get('/del', 'system.Dept/del');
    })->middleware([AuthCheckToken::class]);

})->middleware([AllowCrossDomain::class]);

